<template>
  <div id="main-content">
    <div class="content">
      <el-page-header @back="goBackToList" title="返回列表" content="开盘信息">
      </el-page-header>
      <div class="toolBar">
         <el-link class="info_link" type="primary"  @click="hrefTo('hourseBaseInfo')" icon="el-icon-s-home">基本信息</el-link>
         <el-link class="info_link" type="primary"  @click="hrefTo('hourseEstateInfo')" icon="el-icon-house" >小区信息</el-link>
         <el-link class="info_link" type="primary" @click="hrefTo('hourseImage')" icon="el-icon-picture">图片管理</el-link>
         <el-link class="info_link" type="primary" icon="el-icon-star-on" disabled><h3>开盘信息</h3></el-link>
         <el-link class="info_link" type="primary" @click="hrefTo('hoursePresaleInfo')" icon="el-icon-platform-eleme">预售许可证信息</el-link>
         <el-link class="info_link" type="primary" @click="hrefTo('hourseSaleInfo')" icon="el-icon-s-shop">销售信息</el-link>
         <el-link class="info_link" type="primary" href="" icon="el-icon-s-promotion">相关房产</el-link>
        <el-button type="primary" @click="saveHourseOpeningInfo()" :loading="submitLoading">保存</el-button>
      </div>
      <el-form ref="form" :model="form" label-width="150px">
        <el-form-item label="开盘时间">
          <el-date-picker
            v-model="form.openingDate"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="开盘详情">
          <el-input v-model="form.detail"></el-input>
        </el-form-item>
        <el-form-item label="交房日期">
          <el-date-picker
            v-model="form.deliverDate"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      hourseId:"",
      submitLoading:false,
      form: {
      }
    };
  },
  methods:{
    saveHourseOpeningInfo(){
      this.submitLoading = true;
      this.form.hourseId = this.hourseId;
      this.$http.post("/api/hourseOpeningInfo/save",this.form).then(response=>{
          this.$notify({
            title: '提示',
            message: '保存成功',
            type: 'success'
          });
          this.submitLoading = false;
      });
    },
    getHourseOpeningInfo(hourseId){
      this.$http
        .get("/api/hourseOpeningInfo/get/" + hourseId)
        .then(response => {
          if (response && response.data) {
            this.form = response.data;
          }
        });
    },
    hrefTo(moduleName){
      this.$router.push("/"+moduleName+"/"+this.hourseId)
    },
    goBackToList(){
      this.$router.push("/hourseList");
    }
  },
  created() {
    this.hourseId = this.$route.params.hourseId;
    this.getHourseOpeningInfo(this.hourseId);
  }
};
</script>
<style scoped>
</style>